import { useSelector, useDispatch } from 'react-redux'
import { decrement, increment } from '@/redux-toolkit/count/slice'
import { RootState } from '@/redux-toolkit/store'
import { Button, Space } from 'antd'

export default function ToolkitApp() {
	const count = useSelector((state: RootState) => state.counter.value)
	const dispatch = useDispatch()
	return (
		<Space>
			<Button color="default" variant="solid" aria-label="Increment value" onClick={() => dispatch(increment())}>
				Increment
			</Button>
			<span>{count}</span>
			<Button color="primary" variant="solid" aria-label="Decrement value" onClick={() => dispatch(decrement())}>
				Decrement
			</Button>
		</Space>
	)
}
